<template>
  <header>
    <div class="l-content">
      <img  @click="handleMenu" src="../assets/logo.jpeg" alt="logo">
      <div style="color: #fff; line-height: 1.5">
        <h2>后台管理系统</h2>
        <h3>Background management system</h3>
      </div>
    </div>
    <div class="r-content">
      <el-dropdown @command="clickLogin" trigger="click" size="mini">
        <span>
          <img :src="userImg" class="user" />
        </span>
        <el-dropdown-menu slot="dropdown">
          <el-dropdown-item command="0">个人中心</el-dropdown-item>
          <el-dropdown-item command="1">退出</el-dropdown-item>
        </el-dropdown-menu>
      </el-dropdown>
    </div>
  </header>
</template>

<script>
export default {
  name: "CommonHeader",
  data() {
    return {
      userImg: require("../assets/images/user.jpeg"),
    };
  },
  methods: {
    handleMenu(){
      this.$store.commit('collapseMenu')
    },
    clickLogin(res){
      if(res === '1') this.$router.push('/login')
    }
  }
};
</script>

<style lang="less" scoped>
.l-content img{
  height: 40px;
  width: 40px;
  margin-right: 20px;
}
header{
    display: flex;
    height: 100%;
    justify-content: space-between;
    align-items: center;
}
.l-content{
    display: flex;
    align-items: center;
    .el-button{
        margin-right: 20px;
    }
}
.r-content{
    .user{
        width: 40px;
        height: 40px;
        border-radius:50% ;
    }
}
</style>
